package com.atguigu.java;

/**
 * 使用enum关键字定义枚举类
 * @author : leimingchao
 * @date Date : 2021年06月26日 15:27
 */
public class SeasonTest2 {

    public static void main(String[] args) {
        Season2 summer = Season2.SUMMER;
        //toString()方法:返回枚举类对象的名称
        System.out.println(summer);

        //java.lang.Enum
        // System.out.println(Season2.class.getSuperclass());
        System.out.println("**************************8");
        //values()：返回所有的枚举类对象构成的数组
        Season2[] values = Season2.values();
        for (Season2 value : values) {
            System.out.println(value);
            value.show();
        }

        System.out.println("***************************");
        for (Thread.State state : Thread.State.values()) {
            System.out.println(state);
        }

        System.out.println("***************************");

        //valueOf(String str):返回枚举类中对象名是str的对象，如果没有str的枚举类对象，则抛异常IllegalArgumentException
        // Season2 winter = Season2.valueOf("WINTER1");
        Season2 winter = Season2.valueOf("WINTER");
        System.out.println(winter);
        winter.show();
    }
}
